<%-- 
    Document   : addSpiel
    Created on : 10.05.2012, 09:59:09
    Author     : Michael Hausegger
--%>
<%--
Import der Netbeans Klassen die anschließend weiter verwendet werden
--%>
<%@page import="beans.Team"%>
<%@page import="beans.Mannschaft"%>
<%@page import="java.util.ArrayList"%>
<%@page import="database.DBAccess"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<%! DBAccess dba = null;%>
<%dba = DBAccess.getInstance();%>
<html>
    <head>
        <script type="text/javascript">
            function numbersonly(e, decimal) {
                var key;
                var keychar;

                if (window.event) {
                    key = window.event.keyCode;
                }
                else if (e) {
                    key = e.which;
                }
                else {
                    return true;
                }
                keychar = String.fromCharCode(key);

                if ((key==null) || (key==0) || (key==8) ||  (key==9) || (key==13) || (key==27) ) {
                    return true;
                }
                else if ((("0123456789").indexOf(keychar) > -1)) {
                    return true;
                }
                else if (decimal && (keychar == ".")) { 
                    return true;
                }
                else
                    return false;
            }
            function 
        </script>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
    <center><body bgcolor="#ffffff">
        <form action="BundesligaServlet">
            <table border="0">
                <tbody>
                    <tr>
                        <td>Heimmannschaft</td>
                        <td>
                            <select name="heimmannschaft">
                                <%
                                    ArrayList<Team> teams = dba.getTeams();
                                    for (Team team : teams) {
                                        out.println("<option value=\"" + team.getId() + "\">" + team.getTeamname() + "</option>");
                                    }
                                %>
                            </select>
                        </td>
                    </tr>
                    <tr>
                        <td>Ausw&auml;rtsmannschaft</td>
                        <td>     <select name="auswaertsmannschaft">
                                <%

                                    for (Team team : teams) {
                                        out.println("<option value=\"" + team.getId() + "\">" + team.getTeamname() + "</option>");
                                    }
                                %>
                            </select></td>
               
                    </tr>
              
                    <tr >
                     
                        <td><br></br>Tore Heimmannschaft</td>
                        <td><br></br><input type="text" name="toreheim" onKeyPress="return numbersonly(event, false)"></input></td>
                    </tr>
                    <tr>
                        <td>Tore Ausw&auml;rtsmannschaft</td>
                        <td><input type="text" name="toreauswaerts" onKeyPress="return numbersonly(event, false)"></input></td>
                   
                    </tr>
                </tbody>
            </table>
            <input type="submit" value="Add" />
        </form>
    </body></center>
</html>
